import { getQuestionData } from "../../utils/api";

const QuestionModule = {
  state: {
    data: [],
  },
  mutations: {
    getquestion(state, payload) {
      // if (state.data.length < 8) {
      state.data = state.data.concat(
        payload.res.result.splice(payload.start, 2)
      );
      // }
    },
  },
  actions: {
    async getQuestionAsync({ commit }, payload) {
      const res = await getQuestionData();
      console.log(1);
      commit("getquestion", {
        res: res.data,
        payload,
      });
    },
  },
};

export default QuestionModule;
